package org.hhchat.others.microsoft;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by HMH on 2017/3/31.
 * 微软第一题
 */
public class microsoft01
{
    static double sum=0;
    public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            while(scanner.hasNext()){
                double P = scanner.nextDouble()/100;
                double Q = scanner.nextDouble()/100;
                int N = scanner.nextInt();
                List<Double> local = new ArrayList<>();
                int count=0;
                local.add(reset(P,count));
                dfs(P, Q, N, 1, local, 1);
                local.add(update(P,Q));
                dfs(P, Q, N, 1, local, 2);
                System.out.printf("%.2f",sum);

            }
    }


    private static void dfs(double P, double Q, int N, int count, List<Double> local, int deep) {

        if(count==N){
            double localp = deep;
            for(int i=0;i<deep;i++) {
                localp *= local.get(i);
            }
            System.out.println(local);
            sum+=localp;
            return ;
        }

        local.add(reset(P,count));

        dfs(reset(P,count),Q,N,count+1,local,deep+1);

        local.remove(local.size() - 1);

        local.add(Q);
        local.add(update(P, Q));

        dfs(P,Q,N,count+1,local,deep+2);

        local.remove(local.size() - 1);
        local.remove(local.size() - 1);
    }


    private static double reset(double P,double count){
        return  ((P*1000 / Math.pow(2, count)))/1000.0;
    }

    private static double update(double P,double Q){
        return (P+Q)>1?1.0:(P+Q);
    }
}
